//
//  DiscoverFriendsCell.m
//  E_ChatRoom
//
//  Created by rimi on 15/6/30.
//  Copyright (c) 2015年 TJ. All rights reserved.
//

#import "DiscoverFriendsCell.h"
#import "XMPPvCardTemp.h"

@interface DiscoverFriendsCell () {
    UIImageView *_headImageView;
    UILabel *_nameLabel;
    UILabel *_genderLabel;
    UILabel *_placeLabel;
    UILabel *_desceLabel;
}

- (void)initilizeAppearance;

@end

@implementation DiscoverFriendsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initilizeAppearance];
        [self loadVcard];
    }
    return self;
}



- (void)initilizeAppearance {
    
    
    _headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 70, 70)];
    _headImageView.backgroundColor = [UIColor redColor];
    _headImageView.layer.cornerRadius = 35;
    [self.contentView addSubview:_headImageView];
    
    _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 5, 150, 30)];
    _nameLabel.text = @"Frekle";
    [self.contentView addSubview:_nameLabel];
    
    _genderLabel = ({
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetWidth(_nameLabel.bounds) + 30, 5, 150, 30)];
        _nameLabel.text = @"17";
        _nameLabel.font = [UIFont systemFontOfSize:14];
        _nameLabel;
    });
    [self.contentView addSubview:_genderLabel];
    
    _placeLabel = ({
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 30, 150, 30)];
        _nameLabel.text = @"成都";
        _nameLabel.font = [UIFont systemFontOfSize:14];
        _nameLabel;
    });
    [self.contentView addSubview:_placeLabel];
    
    _desceLabel = ({
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 50, 200, 30)];
        _nameLabel.text = @"i am the king of the world!";
        _nameLabel.font = [UIFont systemFontOfSize:14];
        _nameLabel;
    });
    [self.contentView addSubview:_desceLabel];
    
}

- (void)setDataSource:(NSMutableDictionary *)dataSource {
    _dataSource = dataSource;
    if (_dataSource.count > 0) {
        
    }
}

- (void)loadVcard {
    
    
//    NSString *jid = [WCUserInfo sharedWCUserInfo].jid;
    
    NSString *JIDString = [NSString stringWithFormat:@"%@@%@",[XMPPTool sharedXMPPTool],AllDomain];
    
    XMPPvCardTemp *findNewFriend = [[XMPPTool sharedXMPPTool].vCard vCardTempForJID:[XMPPJID jidWithString:@"123"] shouldFetch:YES];
    
//    XMPPvCardTemp *findNewFriend = [[XMPPTool sharedXMPPTool].vCard.myvCardTemp
    
    if (findNewFriend.photo) {
        _headImageView.image = [UIImage imageWithData:findNewFriend.photo];
    }
    
    _nameLabel.text = findNewFriend.nickname;
    
//    _genderLabel.text = findNewFriend.bday;
    
    
    
}

@end
